package com.gopay.common.user.dao.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.cauth.CAuthOperRoleRel;
import com.gopay.common.user.dao.CauthOperRoleRelDAO;

/**
 * 用户角色定义DAO实现
 * 
 * @CauthOperRoleRelDAOImpl.java
 * @author yaobo
 * @2013-8-5 上午10:26:57 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("cauthOperRoleRelDao")
public class CauthOperRoleRelDAOImpl extends BaseDAOImpl<CAuthOperRoleRel, Serializable> implements CauthOperRoleRelDAO {

    @Override

    public CAuthOperRoleRel getCauthOperRoleRel(String operId, String roleId) {
        String hql = "from CAuthOperRoleRel where operId = :operId and roleId = :roleId";

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("operId", operId);
        params.put("roleId", roleId);

        List<CAuthOperRoleRel> list = this.findByHql(hql, params);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }

        return null;
    }

}